#ifndef D3DUTILS_H
#define D3DUTILS_H

#include <d3dx9.h>
#include <DxErr.h>
#include <iostream>
#include <string>
#include <Windows.h>
#include <tchar.h>
#include <time.h>
#include <vector>

#include "GameTimer.h"
#include "DirectInput.h"

// Forward Declaration
class D3DApp;

extern D3DApp* gD3DApp;
extern IDirect3DDevice9* gD3DDevice;

// Macro
#define ReleaseCOM(x)	\
{						\
	if (x)				\
	{					\
		x->Release();	\
		x = 0;			\
	}					\
}

#if defined(DEBUG) | defined(_DEBUG)
#ifndef HR
#define HR(x)											\
{														\
	HRESULT hr = x;										\
	if (FAILED(hr))										\
	{													\
		DXTrace(__FILE__, __LINE__, hr, #x, true);		\
	}													\
}
#endif
#else
#ifndef HR
#define HR(x) x;
#endif
#endif
#endif